package com.gadgets.busi.bm01.controller;

import com.gadgets.busi.bm01.dto.TxtCopyQueryDTO;
import com.gadgets.busi.bm01.pojo.CopyTxtTask;
import com.gadgets.busi.bm01.service.ITxtCopyQueryService;
import com.gadgets.framework.common.dto.HttpBaseResp;
import com.gadgets.framework.common.dto.Pagination;
import com.gadgets.framework.common.exception.GadgetsServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * @author UncleXiu
 * @version V1.0.0
 * @data 2022-03-08
 */
@RestController
@RequestMapping(value = "/txtCopy")
public class TxtCopySearchController {

    @Autowired
    @Qualifier(value = "txtCopyQueryServiceImpl")
    private ITxtCopyQueryService txtCopyQueryService;

    /**
     * 分页条件查询文本拷贝任务
     * @param request                       网络请求
     * @param response                      网络应答
     * @param queryDTO                      查询条件
     * @param pagination                    分页条件
     * @return                              查询结果
     * @throws GadgetsServiceException      异常信息
     */
    @RequestMapping(value = "/selectTxtCopyTask.do")
    public HttpBaseResp<CopyTxtTask> queryTxtCopyByCondition(HttpServletRequest request, HttpServletResponse response, TxtCopyQueryDTO queryDTO, Pagination pagination) throws GadgetsServiceException{
        List<CopyTxtTask> taskList = txtCopyQueryService.selectCopyTaskInfo(queryDTO, pagination);
        return new HttpBaseResp<>(taskList, pagination);
    }

}
